package com.example.peibei.ui.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.dingtao.common.bean.Evaluate;
import com.dingtao.common.bean.SearchResult;
import com.example.peibei.R;
import com.example.peibei.ui.utils.LevelImage;

import java.util.List;
import java.util.Random;

public class EvaluateAdapter extends BaseQuickAdapter<Evaluate, BaseViewHolder> {
    Context context;

    public EvaluateAdapter(@Nullable List<Evaluate> data, Context context) {
        super(R.layout.item_evaluate, data);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, Evaluate item) {
        helper.setText(R.id.tv_name, item.getEvaluate());
        TextView tv_name = helper.getView(R.id.tv_name);
        LinearLayout ll_evaluate = helper.getView(R.id.ll_evaluate);
        LevelImage.setEvaluate(tv_name, ll_evaluate, new Random().nextInt(5),context);
    }
}
